<!DOCTYPE html>
<html>

<head>
    <meta content="telephone=no" name="format-detection">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Language" content="zh-CN">
    <meta http-equiv="x-ua-compatible" content="IE=edge, chrome=1">
    <meta name="viewport"
        content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <meta name="keywords" content="关键词" />
    <meta name="description" content="页面简介" />
    <link rel="icon" href="favicon.ico" />
    <link rel="shortcut icon" href="favicon.ico" />
    <link href="csaa/css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="./csaa/fonts/iconfont/iconfont.css">
    <link rel="stylesheet" href="./csaa/fonts/materialicons/material-icons.css">

    <script language="javascript" type="text/javascript" src="./csaa/js/jquery.min.js"></script>
    <script src="./csaa/js/httpPath.js"></script>
    <script src="./csaa/js/httpUtils.js"></script>
    <script language="javascript" type="text/javascript" src="./csaa/js/site.js"></script>
    <title>全国青少年航空科学素质等级考试</title>
</head>

<body class="register" style="background-color: #efefef;">
    <!-- 头部 开始 -->
    <div class="header query_header">

    </div>
    <!-- 头部 结束 -->




    <!-- 主体 开始 -->
    <div id="query_main">
        <div class="query_content limitwidth">

            <div class="query_box">
                <div class="part_title">我的证书</div>
                <div class="query_info">

                </div>
            </div>

        </div>
        <div class="footer">@ 全国青少年无人机科学素质等级考试</div>

    </div>
    <!-- 主体 结束 -->
    <!-- 证书模板 开始 -->
    <div id="tmp_item_cert" style="display:none;">
        <div class="info_item">
            <div class="title_wrap">
                <div class="item grade_name">
                    <i class="material-icons">&#xe8e8;</i>
                    <span class="text">初级</span>
                </div>
                <div class="item grade_num">超管，3月8日学生二级考试</div>
                <div class="item grade_result">
                    <span class="text">通过</span>
                </div>
                <div class="item grade_more">
                    <i class="material-icons on">&#xe313;</i>
                    <i class="material-icons off">&#xe316;</i>
                </div>
            </div>
            <div class="cert_info">
                <div class="cert_box">
                    <img src="" class="img">
                </div>
            </div>
        </div>
    </div>
    <!-- 证书模板 结束 -->
    <script>
        getQueryString();
        var idNum = getQueryString("idNum");
        var cardId = getQueryString("cardId");
        //var phone = getQueryString("phone");
       // var email = getQueryString("email");
        //var type = getQueryString("type");

        $(document).on("click", ".title_wrap", function () {
            $(this).find(".grade_more").toggleClass("active")
            $(this).siblings(".cert_info").slideToggle();
        })

        var tmp_parms = {
            "idNum": idNum,
            "cardId": cardId,
            // "phone": phone,
            // "email": email,
            // "type": type,
        };

        $.ajax({
            type: "POST",
            url: REG_QUERY,
            dataType: "json",
            data: tmp_parms,
            timeout: 20000,
            beforeSend:function(){
                $(".query_info").html("<div class=\"nothing\">正在查找...请稍后...</div>");
            },
            success: function (data, textStatus) {
                if (typeof data != "object") {
                    data = $.parseJSON(data);
                }

                //console.log(data)
                if (data.status == 1) {
                    var $tmp_html = $("<div/>");
                    var fetch_data = data.data;
                    $(".query_info").html('');
                    //没有更多内容了

                    for (var i = 0; i < fetch_data.length; i++) {

                        var $tmp_item = $("#tmp_item_cert .info_item").clone();

                        $tmp_item.find(".img").attr("src", fetch_data[i].pic );
                        $tmp_item.find(".grade_name .text").text(fetch_data[i].timesName);//title证书名称
                        $tmp_item.find(".grade_num").text(fetch_data[i].level + "级");//title证书等级
                        if (fetch_data[i].role == "1") {//教师
                            if (fetch_data[i].level == "1") {
                                $tmp_item.find(".grade_num").text("初级");
                            }
                            if (fetch_data[i].level == "2") {
                                $tmp_item.find(".grade_num").text("中级");
                            }
                            if (fetch_data[i].level == "3") {
                                $tmp_item.find(".grade_num").text("高级");
                            }
                            if (fetch_data[i].level == "4") {
                                $tmp_item.find(".grade_num").text("特级");
                            }
                        }
                        if (fetch_data[i].role == "2") {//裁判
                            if (fetch_data[i].level == "1") {
                                $tmp_item.find(".grade_num").text("初级");
                            }
                            if (fetch_data[i].level == "2") {
                                $tmp_item.find(".grade_num").text("中级");
                            }
                            if (fetch_data[i].level == "3") {
                                $tmp_item.find(".grade_num").text("高级");
                            }
                        }

                        $tmp_html.append($tmp_item);

                    }
                    $tmp_html.find(".info_item").appendTo(".query_info");

                } else {
                    $(".query_info").html("<div class=\"nothing\">暂未找到你的证书...</div>");
                }

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.fn.winktips("连接超时，请检查您的网络");
            }
        })
    </script>
</body>

</html>
